<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>

        let flag = true;
        let p1 = new Promise(function (resolved, rejected) {
            console.log('run')
            if (flag) {
                resolved('success')
            } else {
                rejected('fail')
            }
        }).then(
            function (res) {
                console.log(res)
            },
            function (err) {
                // console.log(err)
                throw new Error(err)
            }
        )

        let flag2 = false;
        let p2 = new Promise(function (resolved, rejected) {
            console.log('go')
            if (flag2) {
                resolved('success')
            } else {
                rejected('fail')
            }
        }).then(
            function (res) {
                console.log(res)
            },
            function (err) {
                throw new Errow(err)
            }
        )

        let p3 = new Promise(function (resolved, rejected) {
            console.log('run')
            if (flag) {
                resolved('good')
            } else {
                rejected('bad')
            }
        }).then(
            function (res) {
                console.log(res)
            },
            function (err) {
                throw new Errow(err)
            }
        )

    </script>
</body>

</html>